#include <iostream>
using namespace std;

struct node {
	int val;
	struct node* next;
};

struct node* insert(struct node* head, int val) {
	struct node* tmp = (struct node*)malloc(sizeof(struct node));
	tmp->val = val;
	tmp->next = head->next;
	head->next = tmp;

	return tmp;
}

void remove(struct node* head, struct node* & ptr) {
	if (ptr->next == NULL) {
		free(ptr);
		ptr = NULL;

		return;
	}

	struct node* tmp = ptr->next;
	ptr->val = tmp->val;
	ptr->next = tmp->next;

	free(tmp);
	return;
}

//struct s1 {
//	int v;
//};
//
//typedef struct s1 _S1;
//
//void f(_S1 s) {
//	cout<<"f(_S1)"<<endl;
//}
//
//void f(struct s1 s) {
//	cout<<"f(struct s1)"<<endl;
//}
//
//
//int main() {
//	struct s1 o1;
//	f(o1);
//}

//int main() {
//	struct node* head = (struct node*)malloc(sizeof(struct node));
//	head->next = NULL;
//	struct  node* tmp0 =insert(head, 1);
//	insert(head, 2);
//	struct  node* tmp1 = insert(head, 3);
//	struct  node* tmp2 =insert(head, 4);
//
//	remove(head, tmp0);
//
//	return 0;
//}